<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>${person.name}</title>
    </head>
    <body>
        <div class="body">
            <h1>${person.name}</h1>
            <g:if test="${flash.message}">
            	<div class="message">${flash.message}</div>
            </g:if>
            
			<g:form action="singleUpdate" method="post" style="width:500px;">
                <div class="dialog">
                    <table>
                        <tbody>
                        <g:hiddenField name="id" value="${person.id}" />
                        <tr class="prop">
                            <td valign="top" class="uid">
                                <label for="uid">認證號碼:</label>
                            </td>
                            <td valign="top" class="value ${hasErrors(bean:person,field:'uid','errors')}">
                                <g:hiddenField name="oriUid" value="${person.uid}" />
                                <input type="text" id="uid" name="uid" value="${person.uid}"/>
                            </td>
                        </tr> 
                        
                        <tr class="prop">
                            <td valign="top" class="name">
                                <label for="name">*姓名:</label>
                            </td>
                            <td valign="top" class="value ${hasErrors(bean:person,field:'name','errors')}">
                            	<g:hiddenField name="oriName" value="${person.name}" />
                                <input type="text" id="name" name="name" value="${person.name}"/>
                            </td>
                        </tr>
                        
                        <tr class="prop">
                           <td valign="top" class="surname">
                               <label for="surname">surname:</label>
                           </td>
                           <td valign="top" class="value ${hasErrors(bean:person,field:'surname','errors')}">
                           	   <g:hiddenField name="oriSurname" value="${person.surname}" />
                               <input type="text" id="surname" name="surname" value="${person.surname}"/>
                           </td>
                       	</tr>
                       	
                       	<tr class="prop">
                            <td valign="top" class="sport">
                                <label for="sport">*運動項目:</label>
                            </td>
                            <td valign="top" class="value ${hasErrors(bean:person,field:'sport','errors')}">
                            	<g:hiddenField name="oriSport" value="${person.sport.id}" />
                            	<g:select name="sport.id" from="${Sport.list()}" value="${person.sport.id}" optionKey="id" optionValue="name"/>
                            </td>
                        </tr>  
                        
                        <tr class="prop">
                             <td valign="top" class="nation">
                                 <label for="nation">*國別:</label>
                             </td>
                             <td valign="top" class="value ${hasErrors(bean:person,field:'nation','errors')}">
                             	<g:hiddenField name="oriNation" value="${person.nation.id}" />
                             	<g:select name="nation.id" from="${Nation.list()}" value="${person.nation.id}" optionKey="id" optionValue="name"/>
                             </td>
                         </tr>  
                         
                        <tr class="prop">
                            <td valign="top" class="hotel">
                                <label for="hotel">旅館:</label>
                            </td>
                            <td valign="top" class="value ${hasErrors(bean:person,field:'hotel','errors')}">
                            	<g:hiddenField name="oriHotel" value="${person.hotel}" />
                                <input type="text" id="hotel" name="hotel" value="${person.hotel}"/>
                            </td>
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="sex">
                                <label for="sex">*性別:</label>
                            </td>
                            <td valign="top" class="value ${hasErrors(bean:person,field:'sex','errors')}">
                            	<g:hiddenField name="oriSex" value="${person.sex}" />
                                <g:select name="sex" from="['M', 'F']" value="${person.sex}"/>
                            </td>
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="category">
                                <label for="category">類別:</label>
                            </td>
                            <td valign="top" class="value ${hasErrors(bean:person,field:'category','errors')}">
                            	<g:hiddenField name="oriCategory" value="${person.category}" />
                                <input type="text" id="category" name="category" value="${person.category}"/>
                            </td>
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="comeDateAt">
                                <label for="comeDateAt">預計抵達日期:</label>
                            </td>
                            <td valign="top" class="value ${hasErrors(bean:activityInstance,field:'comeDateAt','errors')}">
                                <g:if test="${person?.comeDateAt}">
                                <g:hiddenField name="oriComeDateAt_year" value="${person?.comeDateAt?.getYear()+1900}" />
                                <g:hiddenField name="oriComeDateAt_month" value="${person?.comeDateAt?.getMonth()+1}" />
                                <g:hiddenField name="oriComeDateAt_day" value="${person?.comeDateAt?.getDate()}" />
                                <g:hiddenField name="oriComeDateAt_hour" value="${person?.comeDateAt?.getHours()}" />
                                <g:hiddenField name="oriComeDateAt_minute" value="${person?.comeDateAt?.getMinutes()}" />
                                </g:if>
                                <g:datePicker name="comeDateAt" value="${person?.comeDateAt}" precision="minute" ></g:datePicker>
                                (如果是現在時間，通常就是沒有資料)
                            </td>
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="comeFlight">
                                <label for="comeFlight">抵達班機:</label>
                            </td>
                            <td valign="top" class="value ${hasErrors(bean:person,field:'comeFlight','errors')}">
                            	<g:hiddenField name="oriComeFlight" value="${person.comeFlight}" />
                                <input type="text" id="comeFlight" name="comeFlight" value="${person.comeFlight}"/>
                            </td>
                        </tr>

						<tr class="prop">
                            <td valign="top" class="comeAirport">
                                <label for="comeAirport">抵達機場:</label>
                            </td>
                            <td valign="top" class="value ${hasErrors(bean:person,field:'comeAirport','errors')}">
                            	<g:hiddenField name="oriComeAirport" value="${person.comeAirport?.id}" />
                            	<g:select name="comeAirport.id" from="${Airport.list()}" value="${person.comeAirport?.id}" optionKey="id" optionValue="name"/>
                            </td>
                        </tr>  
                        
                        <tr class="prop">
                            <td valign="top" class="goDateAt">
                                <label for="goDateAt">預計離開日期:</label>
                            </td>
                            <td valign="top" class="value ${hasErrors(bean:activityInstance,field:'goDateAt','errors')}">
                            	<g:if test="${person?.goDateAt}">
                            	<g:hiddenField name="oriGoDateAt_year" value="${person?.goDateAt?.getYear()+1900}" />
                                <g:hiddenField name="oriGoDateAt_month" value="${person?.goDateAt?.getMonth()+1}" />
                                <g:hiddenField name="oriGoDateAt_day" value="${person?.goDateAt?.getDate()}" />
                                <g:hiddenField name="oriGoDateAt_hour" value="${person?.goDateAt?.getHours()}" />
                                <g:hiddenField name="oriGoDateAt_minute" value="${person?.goDateAt?.getMinutes()}" />
                                </g:if>
                                <g:datePicker name="goDateAt" value="${person?.goDateAt}" precision="minute" ></g:datePicker>
                                (如果是現在時間，通常就是沒有資料)
                            </td>
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="goFlight">
                                <label for="goFlight">離開班機:</label>
                            </td>
                            <td valign="top" class="value ${hasErrors(bean:person,field:'goFlight','errors')}">
                            	<g:hiddenField name="oriGoFlight" value="${person.goFlight}" />
                                <input type="text" id="goFlight" name="goFlight" value="${person.goFlight}"/>
                            </td>
                        </tr>
                        
                       <tr class="prop">
                           <td valign="top" class="goAirport">
                               <label for="goAirport">離開機場:</label>
                           </td>
                           <td valign="top" class="value ${hasErrors(bean:person,field:'goAirport','errors')}">
                               <g:hiddenField name="oriGoAirport" value="${person.goAirport?.id}" />
                           	   <g:select name="goAirport.id" from="${Airport.list()}" value="${person.goAirport?.id}" optionKey="id" optionValue="name"/>
                           </td>
                       </tr>  
                       
                       <tr class="prop">
                           <td valign="top" class="note">
                               <label for="note">備註:</label>
                           </td>
                           <td valign="top" class="value ${hasErrors(bean:person,field:'note','errors')}">
                            	<g:hiddenField name="oriNote" value="${person.note}" />
                                <input type="text" id="note" name="note" value="${person.note}"/>
                            </td>
                       </tr>  
                            
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="更新" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
